import router from './router'
import store from './store'

router.beforeEach(async(to, from, next) => {
  const { meta } = to
  store.dispatch('app/toggleHeader', meta)
  const style = 'width:50px; border-bottom:1px solid #999; border-radius:3px; padding: 3px 6px; background:#ffafc9; color:#fff;'
  console.log(`%c现在进入了 [${meta.title}] 页面, 此页面${meta.canBack ? '可' : '不可'}返回`, style)

  next()
})
